﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="costsApplyOrder.aspx.cs" Inherits="CostsManagement_costsApplyOrder" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="../Includes/Guide.css" type="text/css" rel="stylesheet" />
    <link href="../Includes/index.css" type="text/css" rel="stylesheet" />
    <link href="../Includes/MasterPage.css" type="text/css" rel="stylesheet" />
    <link href="../Includes/xtree.css" type="text/css" rel="stylesheet" />
    <link href="../css/MyCss.css" type="text/css" rel="stylesheet" />
    <link href="../css/Style.css" rel="stylesheet" type="text/css" />
    
    <title>费用申请单</title>
    <style type="text/css">
        .style2
        {
            width: 128px;
            text-align: left;
        }
       
        .style4
        {
            width: 77px;
        }
        .style7
        {
            BACKGROUND: #e6eff8;
            LINE-HEIGHT: 120%;
            text-align: center;
            font-size: large;
        }
        .style8
        {
            BACKGROUND: #e6eff8;
            LINE-HEIGHT: 120%;
            width: 128px;
            height: 22px;
        }
        .style9
        {
            height: 22px;
        }
    </style>
</head>
<script src="../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="../Includes/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../Includes/MyJScript.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
    //显示repeater行数
    function display(space) {
        var lineNum = document.getElementById("HiddenField1").value;

        lineNum = space * 1 + lineNum * 1;

        var items = document.getElementsByTagName("div");
        var num = 0;
        for (var i = 0; i < items.length; i++) {
            if (items[i].title == "aa") {
                if (num < lineNum) {
                    items[i].style.display = "block";
                }
                else {
                    items[i].style.display = "none";
                }
                num++;
            }
        }
        document.getElementById("HiddenField1").value = lineNum;
    }
    //错误提示
    function chkLogin() {
        alert("错误：未检测到登录信息，请进行登录！");
        window.navigate("../Login.aspx");
    }

    //关闭当前窗口
    function winCancel() {
        parent.PE_FrameTab.CloseCurrentTab();
    }
    //循环repeater 计算申请金额合计数
    function sumApply() {
        sumtotal = 0;
        var rows = document.getElementsByTagName("div");

        var divs = new Array();

        //var hvalue = document.getElementById("HiddenField3").value;
        var no = 0;
        for (var count = 0; count < rows.length; count++) {

            if (rows[count].title == 'aa' && rows[count].style.display == "block") {
                divs[no] = rows[count];
                no = no + 1;
            }
        }

        for (var i = 0; i < no; i++) {
            sumtotal = sumtotal * 1 + divs[i].childNodes[0].rows[0].cells[2].childNodes[0].value * 1;
            //alert(divs[i].childNodes[0].rows[0].cells[1].childNodes[0].value);

        }
        document.getElementById("lblSumAppMoney").innerText = sumtotal;
    }

   
</script>
<body onload="display(0)">
    <form id="form1" runat="server">
    <div class="inputbuttondiv">
    <asp:Button ID="btnSave" runat="server" Text="保存" onclick="btnSave_Click" CssClass="inputbutton"  />
    <asp:Button ID="btnUpd" runat="server" Text="修改" CssClass="inputbutton" 
            onclick="btnUpd_Click"  />
    <asp:Button ID="btnCancel" runat="server" Text="取消" CssClass="inputbutton" OnClientClick="winCancel()"/>
    <asp:Button ID="btnApprov" runat="server" Text="审批" CssClass="inputbutton" onclick="btnApprov_Click" 
             />
    <asp:Button ID="btnNoApprov" runat="server" Text="驳回" CssClass="inputbutton" onclick="btnNoApprov_Click" 
             />
    </div>
    <table class="item" style="margin:0px 0px 0px 0px; width:661px">
        <tr>
            <td class="tdbg" style="width:128px">
                单据号</td>
            <td class="style3" align="left">
                <asp:TextBox ID="txtsysno" runat="server" CssClass="inputtext"></asp:TextBox>
            </td>
            <td class="tdbg" style="width:128px">
                制单日期</td>
            <td class="style2">
                <asp:TextBox ID="txtfilldate" runat="server"  CssClass="Wdate"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="tdbg" style="width:128px">
                所属部门</td>
            <td  align="left">
                <asp:DropDownList ID="ddlapplyDept" runat="server" Width="130px" 
                    AppendDataBoundItems="true" 
                    onselectedindexchanged="ddlapplyDept_SelectedIndexChanged" 
                    AutoPostBack="True">
                                <asp:ListItem Value="-1">-选择-</asp:ListItem>
                                </asp:DropDownList>
                
            </td>
            <td class="tdbg" style="width:128px">
                申请人</td>
            <td class="style2">
                 <asp:DropDownList ID="ddlapplyPsn" runat="server" Width="130px"></asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style8">
                费用使用日期</td>
            <td class="style9" colspan="3"  align="left">
                <asp:TextBox ID="txtcostOfDateB" runat="server" CssClass="Wdate" onFocus="WdatePicker({isShowClear:false,readOnly:true})" Width="120px"></asp:TextBox>
                &nbsp;至
                <asp:TextBox ID="txtcostOfDateE" runat="server"  CssClass="Wdate" onFocus="WdatePicker({isShowClear:false,readOnly:true})" Width="120px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="tdbg" style="width:128px">
                费用用途</td>
            <td class="style3" colspan="3" align="left">
                <asp:TextBox ID="txtcostUse" runat="server" CssClass="inputtext" Width="300px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="tdbg" style="width:128px">
                备&nbsp;&nbsp;&nbsp; 注</td>
            <td class="style3" colspan="3" align="left">
                <asp:TextBox ID="txtremarks" runat="server" CssClass="inputtext" Width="300px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="3" class="style7">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
                费 用 申 请 明 细 </td>
            <td class="tdbg">
    <asp:Button ID="btnAddLine" runat="server" Text="增行" 
                    CssClass="inputbutton" OnClientClick="display(1)"/>
    <asp:Button ID="btnDelLine" runat="server" Text="删行" CssClass="inputbutton"  OnClientClick="display(-1)"/>
            </td>
        </tr>
        <tr>
            <td colspan="4" align="left">
              <asp:Panel ID="Panel1" runat="server" Height="300px" ScrollBars="Both" Width="100%">
                  <table style="width:661;">
                      <tr>
                          <td style="width:60px" align="center">
                              序号</td>
                          <td style="width:160px" align="center">
                              费 用 名 称</td>
                          <td style="width:120px" align="center">
                              申请金额</td>
                          <td style="width:300px" align="center">
                              备&nbsp;&nbsp;&nbsp; 注</td>
                      </tr>
                  </table>
                <asp:Repeater ID="costorderdetRepeater" runat="server" 
                      onitemdatabound="costorderdetRepeater_ItemDataBound">
                 <ItemTemplate>
                        <div id="h" style="display: block; padding-left: 0px; padding-right: 0px;" runat="server" name="h" title="aa">
                        <table cellpadding="0" cellspacing="0" width="350" border="1">
                        <tr>
                        <td class="rtd1"> 
                            <asp:Label ID="txtLineId" runat="server" Text='<%# Eval("lineId") %>' Width="30px"></asp:Label></td>
                            
                            <td><%--<asp:TextBox ID="txtcostsName" runat="server" ondblclick="alertbook(this)" Width="100px"></asp:TextBox>--%>
                                <asp:DropDownList ID="ddlcostsName" runat="server" Width="100px" DataSourceID="CostsObjectDataSource"
                                 DataTextField="name" DataValueField="code" AppendDataBoundItems="true">
                                <asp:ListItem Value="-1">-选择-</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td><asp:TextBox ID="txtapplyMoney" runat="server" Width="100px" CssClass="inputtext" Text='<%# Eval("applymoney") %>' onblur="sumApply()" onKeyPress="CheckNumbric(this)"></asp:TextBox></td>
                            <td><asp:TextBox ID="txtdetremarks" runat="server" Width="200px"  CssClass="inputtext" Text='<%# Eval("remarks") %>'></asp:TextBox></td>
                           
                            </tr>
                            </table>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
                </asp:Panel>
            </td>
        </tr>
        <tr>
            <td class="tdbg" style="width:128px">
                合 计</td>
            <td align="right">
                <asp:Label ID="lblSumAppMoney" runat="server" Width="100px"></asp:Label>
            </td>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="tdbg" style="width:128px">
                制单人</td>
            <td >
                <asp:Label ID="lblfillpsn" runat="server" Width="100px"></asp:Label>
            </td>
            <td class="tdbg" style="width:128px">
                提交人</td>
            <td class="style2">
                <asp:Label ID="lblauthorpsn" runat="server"  Width="100px"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="tdbg" style="width:128px">
                审批人</td>
            <td >
                <asp:Label ID="lblapprovpsn" runat="server"  Width="100px"></asp:Label>
            </td>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="tdbg" style="width:128px">
                审批意见</td>
            <td colspan="3" >
                <asp:TextBox ID="txtcheckInfo" runat="server" Width="99%" Height="100px" 
                    TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
    </table>
    <asp:HiddenField ID="HiddenField1" runat="server" Value="5" />
    <asp:ObjectDataSource ID="CostsObjectDataSource" runat="server" 
        SelectMethod="GetAllList" TypeName="WCSY.BLL.fg_costsManager"></asp:ObjectDataSource>
    </form>
    </body>
</html>
